#!/bin/sh

# Startup script for MasterShaper
# Andreas Unterkircher, unki@netshadow.at

PATH_TO_MS="/var/www/shaper"
TC_COLLECTOR="./tc_collector.pl -d"
INIT_MS="php index.php"

cd ${PATH_TO_MS}

# See how we were called.
case "$1" in
     start)
         echo -n "Starting MasterShaper: "
	 ${INIT_MS} load
	 echo -n "Shaper "
         ${TC_COLLECTOR}
	 echo "tc_collector.pl"
         ;;
      stop)
         echo -n "Stopping Mastershaper: "
	 killall tc_collector.pl
         echo -n "tc_collector.pl "
	 ${INIT_MS} unload
	 echo "Shaper"
         ;;
      restart)
         $0 stop
         $0 start
         ;;
      *)
      echo "Usage: $0 {start|stop|restart}"
      exit 1
esac

exit 0
